package com.example.mapper;

import com.example.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
public interface UserMapper {

    @Select("select * from User")
    List<User> findAll();
    @Insert("insert into User(name,password,sex,time) values(#{name},#{password},#{sex},#{time})")
    void addUser(User users);
    @Delete("delete from User where id=#{id}")
    void delete(Integer id);
    @Select("select * from User where id=#{id}")
    User findById(Integer id);
    @Update("update user set name=#{name},password=#{password},sex=#{sex},time=#{time} where id=#{id}")
    void update(@Param("name") String name, @Param("id") Integer id, @Param("time") Date time, @Param("password") String password, @Param("sex") String sex);

}
